* "GetName" should also use the player name cache, done.
* removed debug output from "processchatai" script.
This commit is contained in:
parent
f0b340ef3d
commit
659a9a7334
@ -126,8 +126,6 @@ loop
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
logdebug AI call: ${call}
|
|
||||||
|
|
||||||
if ${call}
|
if ${call}
|
||||||
// logdebug DEBUG: ChatAI: calling script ${script}, condition ${cond} matched.
|
// logdebug DEBUG: ChatAI: calling script ${script}, condition ${cond} matched.
|
||||||
${script},{${@0}},{${@1}},{${@2}},{${@3}},{${langname}} ${@def}
|
${script},{${@0}},{${@1}},{${@2}},{${@3}},{${langname}} ${@def}
|
||||||
|
|||||||
@ -407,7 +407,8 @@ DefReturnResult DefScriptPackage::SCGetPlayerGuid(CmdSet& Set)
|
|||||||
|
|
||||||
DefReturnResult DefScriptPackage::SCGetName(CmdSet& Set)
|
DefReturnResult DefScriptPackage::SCGetName(CmdSet& Set)
|
||||||
{
|
{
|
||||||
if(!(((PseuInstance*)parentMethod)->GetWSession()))
|
WorldSession *ws = ((PseuInstance*)parentMethod)->GetWSession();
|
||||||
|
if(!ws)
|
||||||
{
|
{
|
||||||
logerror("Invalid Script call: SCGetName: WorldSession not valid");
|
logerror("Invalid Script call: SCGetName: WorldSession not valid");
|
||||||
DEF_RETURN_ERROR;
|
DEF_RETURN_ERROR;
|
||||||
@ -415,7 +416,7 @@ DefReturnResult DefScriptPackage::SCGetName(CmdSet& Set)
|
|||||||
DefReturnResult r;
|
DefReturnResult r;
|
||||||
uint64 guid=DefScriptTools::toNumber(Set.defaultarg);
|
uint64 guid=DefScriptTools::toNumber(Set.defaultarg);
|
||||||
r.ret="Unknown Entity";
|
r.ret="Unknown Entity";
|
||||||
Object *o=((PseuInstance*)parentMethod)->GetWSession()->objmgr.GetObj(guid);
|
Object *o = ws->objmgr.GetObj(guid);
|
||||||
if(o)
|
if(o)
|
||||||
{
|
{
|
||||||
if(o->GetTypeId()==TYPEID_ITEM || o->GetTypeId()==TYPEID_CONTAINER)
|
if(o->GetTypeId()==TYPEID_ITEM || o->GetTypeId()==TYPEID_CONTAINER)
|
||||||
@ -431,7 +432,11 @@ DefReturnResult DefScriptPackage::SCGetName(CmdSet& Set)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logerror("SCGetName: Object "I64FMT" not known",guid);
|
// if no object with that guid is near, it might exist in the cache, check it and use that if present
|
||||||
|
if(ws->plrNameCache.IsKnown(guid))
|
||||||
|
r.ret = ws->plrNameCache.GetName(guid);
|
||||||
|
else
|
||||||
|
logerror("SCGetName: Object "I64FMT" not known",guid);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user