Changeset 3240

Show
Ignore:
Timestamp:
01/28/10 18:56:28 (6 weeks ago)
Author:
ghoulsblade
Message:
charlist skill display fixed for subserverid other than 0, StartTargetMode_ClientSide : no message sent to server, MacroCmd_PlayerDead,MacroCmd_MobileDead , MacroCmd_JobGetTargetClientSide, MacroCmd_StoreLastTarget , MacroCmd_SendStoredTarget , MacroCmd_GetStoredTarget_Serial , MacroCmd_GetStoredTarget_Pos , macropathfind bugfix return value
Location:
trunk/lua
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/lua/lib.cursor.lua

    r3234 r3240  
    101101 
    102102function CleanupTargetMode () 
     103        gNextTargetClientSide = nil -- should be nil already after sendtarget (also used with 0 if cancelled) 
    103104    if (not gTargetModeActive) then return end 
    104105    gSmartLastSpellID = nil -- either cancelled or targetted. 
     
    106107    gTargetModeActive = false 
    107108    NotifyListener("Hook_TargetMode_End") -- always called, even if aborted by server 
     109end 
     110 
     111function StartTargetMode_ClientSide () 
     112        gNextTargetClientSide = true 
     113        StartTargetMode() 
    108114end 
    109115 
     
    122128-- client side cancel 
    123129function CancelTargetMode () 
     130        if (not IsTargetModeActive()) then return end 
    124131    GuiAddChatLine("Target Mode canceled") 
    125132    Send_Target_Cancel() 
  • trunk/lua/lib.macrolist.lua

    r3237 r3240  
    4444function IsPlayerHidden() local mobile = GetPlayerMobile() return mobile and mobile.flag_hidden end 
    4545 
     46function MacroCmd_PlayerDead     () return MacroCmd_MobileDead(GetPlayerMobile()) end 
    4647function MacroCmd_PlayerPoisoned () return MacroCmd_MobilePoisoned(GetPlayerMobile()) end 
    4748function MacroCmd_PlayerMortaled () return MacroCmd_MobileMortaled(GetPlayerMobile()) end 
     49function MacroCmd_MobileDead     (mobile) return mobile and (mobile.artid == 402 or mobile.artid == 403) end -- ghost form 
     50--~ function MacroCmd_MobileDead         (mobile) return mobile and GetMobileRelHP(mobile.serial) == 0 end 
    4851function MacroCmd_MobilePoisoned (mobile) return mobile and IsMobilePoisoned(mobile) end 
    4952function MacroCmd_MobileMortaled (mobile) return mobile and IsMobileMortaled(mobile) end 
     
    184187 
    185188 
     189function MacroCmd_StartTargetModeClientSide () StartTargetMode_ClientSide() end 
     190 
     191function MacroCmd_JobGetTargetClientSide () 
     192        local jobid = job.running_id() assert(jobid) 
     193        local res 
     194        RegisterListener("Hook_TargetMode_Send",function (...) res = {...} job.wakeup(jobid) return true end) 
     195        MacroCmd_StartTargetModeClientSide() 
     196        job.wait(1000*3600*24) 
     197        if (not res) then return end 
     198        local bIsPos,flag,serial,x,y,z,model,bIsCancel = unpack(res) 
     199        if (bIsCancel) then return false end 
     200        return MacroCmd_StoreLastTarget() 
     201end 
     202 
     203function MacroCmd_StoreLastTarget () return CopyArray(gMacroLastTargetMemory) end 
     204function MacroCmd_SendStoredTarget (t) return CompleteTargetMode(t) end 
     205function MacroCmd_GetStoredTarget_Serial (t) 
     206        if (not t) then return end 
     207    if (t.hittype == kMousePickHitType_Mobile) then return t.mobile.serial end 
     208    if (t.hittype == kMousePickHitType_Dynamic) then return t.dynamic.serial end 
     209end 
     210function MacroCmd_GetStoredTarget_Pos (t) 
     211        if (not t) then return end 
     212    if (t.hittype == kMousePickHitType_Mobile) then return t.mobile.xloc,t.mobile.yloc,t.mobile.zloc end 
     213    if (t.hittype == kMousePickHitType_Dynamic) then return t.dynamic.xloc,t.dynamic.yloc,t.dynamic.zloc end 
     214    if (t.hittype == kMousePickHitType_Static) then return t.hit_xloc,t.hit_yloc,t.hit_zloc end 
     215    if (t.hittype == kMousePickHitType_Ground) then return t.x,t.y,t.z end 
     216    return t.hit_xloc,t.hit_yloc,t.hit_zloc 
     217end 
     218         
    186219function MacroCmd_PopupCommandByTag (serial,tag,timeout) 
    187220    local timeout_endt = Client_GetTicks() + (timeout or 1000) 
     
    10481081        local bLog = not bNoLog 
    10491082        if (bLog) then print("MacroCmd_PathFindTo : start",xloc,yloc,tolerance,timeout) end 
    1050         if (GetUODistToPlayer(xloc,yloc) <= tolerance) then  
    1051                 if (bLog) then print("MacroCmd_PathFindTo : already there") end 
    1052                 return true  
    1053         end 
    10541083        local iJobWaitInterval = 50 
    10551084        timeout = timeout or 0 
    10561085        local endt = (timeout > 0) and (Client_GetTicks() + timeout) 
    10571086        repeat -- repeat the pathfinding calc every few seconds in case dynamics show up 
     1087                if (GetUODistToPlayer(xloc,yloc) <= tolerance) then  
     1088                        if (bLog) then print("MacroCmd_PathFindTo : already there") end 
     1089                        return true  
     1090                end 
    10581091                local t = Client_GetTicks() 
    10591092                local res = cPathFind2:CalcRouteFromPlayerToPos(xloc,yloc,tolerance,iJobWaitInterval,endt and (endt-t))  
  • trunk/lua/lib.mainmenu.accountlist.lua

    r3100 r3240  
    5858                bHadFirstChar = true 
    5959                 
    60                 local chardata = SimpleXMLLoad(GetCharFilePath(user,char.id)) 
     60                local chardata = SimpleXMLLoad(GetCharFilePath(user,char.id,0)) or SimpleXMLLoad(GetCharFilePath(user,char.id,1)) 
     61                                print("MainMenu_AccountList_Start GetCharFilePath",user,char.id,chardata) 
    6162                local charinfo = "" 
    6263                if (chardata) then 
  • trunk/lua/lib.shardlist.lua

    r3214 r3240  
    55function GetShardListDirPath            () return GetConfigDirPath().."shards/" end 
    66function GetShardMemoryFilePath         () return GetConfigDirPath().."shardmemory.xml" end 
    7 function GetCharFilePath                (loginname,charid) return GetConfigDirPath().."chars/"..table.concat({gLoginServerIP,gLoginServerPort,ShardListFileNamePartEncode(loginname or gLoginname),(giGameServerID or 0),(charid or gCharID or 0)},".")..".xml" end 
     7function GetCharFilePath                (loginname,charid,subserverid) return GetConfigDirPath().."chars/"..table.concat({gLoginServerIP,gLoginServerPort,ShardListFileNamePartEncode(loginname or gLoginname),(subserverid or giGameServerID or 0),(charid or gCharID or 0)},".")..".xml" end 
    88function GetShardConfigFilePath         (shardname) return GetShardListDirPath()..ShardListFileNamePartEncode(shardname)..".xml" end 
    99 
  • trunk/lua/net/net.cursor.lua

    r3210 r3240  
    5252 
    5353-- Send Targetcursor (0x6c) 
    54 function Send_Target (bIsPos,flag,serial,x,y,z,model) 
     54function Send_Target (bIsPos,flag,serial,x,y,z,model,bIsCancel) 
    5555        print("Send_Target",bIsPos,hex(flag),hex(serial),x,y,z,hex(model)) 
    5656        --printf("NET: Send_Target: %d 0x%02x 0x%08x %d %d %d 0x%04x\n",bIsPos and 1 or 0,flag,serial,x or 0,y or 0,z or 0,model or 0) 
    57         local out = GetSendFIFO() 
    58         out:PushNetUint8(kPacket_Target) 
    59         out:PushNetUint8(bIsPos and kTargetModeType_Pos or kTargetModeType_Object) 
    60         out:PushNetUint32(gTargetModeSerial) 
    61         out:PushNetUint8(flag) 
    62         out:PushNetUint32(serial) 
    63         out:PushNetUint16(x or 0) 
    64         out:PushNetUint16(y or 0) 
    65         out:PushNetUint16(z or 0)               -- out:PushInt16(z) 
    66         out:PushNetUint16(model or 0)   -- ArtID, ModelID (granny) 
    6757         
    68         NotifyListener("Hook_TargetMode_Send",bIsPos,flag,serial,x,y,z,model) -- called on target and cancel-by-client, but not if aborted by server 
    69         out:SendPacket() 
     58        if (gNextTargetClientSide) then  
     59                gNextTargetClientSide = nil 
     60        else 
     61                local out = GetSendFIFO() 
     62                out:PushNetUint8(kPacket_Target) 
     63                out:PushNetUint8(bIsPos and kTargetModeType_Pos or kTargetModeType_Object) 
     64                out:PushNetUint32(gTargetModeSerial) 
     65                out:PushNetUint8(flag) 
     66                out:PushNetUint32(serial) 
     67                out:PushNetUint16(x or 0) 
     68                out:PushNetUint16(y or 0) 
     69                out:PushNetUint16(z or 0)               -- out:PushInt16(z) 
     70                out:PushNetUint16(model or 0)   -- ArtID, ModelID (granny) 
     71                out:SendPacket() 
     72        end 
     73         
     74        NotifyListener("Hook_TargetMode_Send",bIsPos,flag,serial,x,y,z,model,bIsCancel) -- called on target and cancel-by-client, but not if aborted by server 
    7075end 
    7176 
     
    7378function Send_Target_Cancel ()  
    7479        NotifyListener("Hook_TargetMode_CancelByClient") 
    75         Send_Target(false,0,0x00000000,hex2num("0xFFFF"),hex2num("0xFFFF"),0,0) 
     80        Send_Target(false,0,0x00000000,0xFFFF,0xFFFF,0,0,true) 
    7681end 
    7782 
  • trunk/lua/net/net.mobile.lua

    r3203 r3240  
    183183         
    184184        stats.mobstatversion    = MySave_PopNetUint8() 
     185         
     186        print("stats.mobstatversion",hex(stats.mobstatversion)) 
    185187         
    186188        -- mobstatversion : http://docs.polserver.com/packets/index.php?Packet=0x11 
  • trunk/lua/net/net.partysystem.lua

    r3179 r3240  
    229229        print("PartyListDialog_StartInviteMode")  
    230230        -- start targetting mode 
    231         StartTargetMode() 
     231        StartTargetMode_ClientSide() 
    232232        gPartyList_InviteNextTarget = true 
    233233end