Changeset 3240
- Timestamp:
- 01/28/10 18:56:28 (6 weeks ago)
- Location:
- trunk/lua
- Files:
-
- 7 modified
-
lib.cursor.lua (modified) (3 diffs)
-
lib.macrolist.lua (modified) (3 diffs)
-
lib.mainmenu.accountlist.lua (modified) (1 diff)
-
lib.shardlist.lua (modified) (1 diff)
-
net/net.cursor.lua (modified) (2 diffs)
-
net/net.mobile.lua (modified) (1 diff)
-
net/net.partysystem.lua (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lua/lib.cursor.lua
r3234 r3240 101 101 102 102 function CleanupTargetMode () 103 gNextTargetClientSide = nil -- should be nil already after sendtarget (also used with 0 if cancelled) 103 104 if (not gTargetModeActive) then return end 104 105 gSmartLastSpellID = nil -- either cancelled or targetted. … … 106 107 gTargetModeActive = false 107 108 NotifyListener("Hook_TargetMode_End") -- always called, even if aborted by server 109 end 110 111 function StartTargetMode_ClientSide () 112 gNextTargetClientSide = true 113 StartTargetMode() 108 114 end 109 115 … … 122 128 -- client side cancel 123 129 function CancelTargetMode () 130 if (not IsTargetModeActive()) then return end 124 131 GuiAddChatLine("Target Mode canceled") 125 132 Send_Target_Cancel() -
trunk/lua/lib.macrolist.lua
r3237 r3240 44 44 function IsPlayerHidden() local mobile = GetPlayerMobile() return mobile and mobile.flag_hidden end 45 45 46 function MacroCmd_PlayerDead () return MacroCmd_MobileDead(GetPlayerMobile()) end 46 47 function MacroCmd_PlayerPoisoned () return MacroCmd_MobilePoisoned(GetPlayerMobile()) end 47 48 function MacroCmd_PlayerMortaled () return MacroCmd_MobileMortaled(GetPlayerMobile()) end 49 function 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 48 51 function MacroCmd_MobilePoisoned (mobile) return mobile and IsMobilePoisoned(mobile) end 49 52 function MacroCmd_MobileMortaled (mobile) return mobile and IsMobileMortaled(mobile) end … … 184 187 185 188 189 function MacroCmd_StartTargetModeClientSide () StartTargetMode_ClientSide() end 190 191 function 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() 201 end 202 203 function MacroCmd_StoreLastTarget () return CopyArray(gMacroLastTargetMemory) end 204 function MacroCmd_SendStoredTarget (t) return CompleteTargetMode(t) end 205 function 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 209 end 210 function 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 217 end 218 186 219 function MacroCmd_PopupCommandByTag (serial,tag,timeout) 187 220 local timeout_endt = Client_GetTicks() + (timeout or 1000) … … 1048 1081 local bLog = not bNoLog 1049 1082 if (bLog) then print("MacroCmd_PathFindTo : start",xloc,yloc,tolerance,timeout) end 1050 if (GetUODistToPlayer(xloc,yloc) <= tolerance) then1051 if (bLog) then print("MacroCmd_PathFindTo : already there") end1052 return true1053 end1054 1083 local iJobWaitInterval = 50 1055 1084 timeout = timeout or 0 1056 1085 local endt = (timeout > 0) and (Client_GetTicks() + timeout) 1057 1086 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 1058 1091 local t = Client_GetTicks() 1059 1092 local res = cPathFind2:CalcRouteFromPlayerToPos(xloc,yloc,tolerance,iJobWaitInterval,endt and (endt-t)) -
trunk/lua/lib.mainmenu.accountlist.lua
r3100 r3240 58 58 bHadFirstChar = true 59 59 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) 61 62 local charinfo = "" 62 63 if (chardata) then -
trunk/lua/lib.shardlist.lua
r3214 r3240 5 5 function GetShardListDirPath () return GetConfigDirPath().."shards/" end 6 6 function 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" end7 function 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 8 8 function GetShardConfigFilePath (shardname) return GetShardListDirPath()..ShardListFileNamePartEncode(shardname)..".xml" end 9 9 -
trunk/lua/net/net.cursor.lua
r3210 r3240 52 52 53 53 -- Send Targetcursor (0x6c) 54 function Send_Target (bIsPos,flag,serial,x,y,z,model )54 function Send_Target (bIsPos,flag,serial,x,y,z,model,bIsCancel) 55 55 print("Send_Target",bIsPos,hex(flag),hex(serial),x,y,z,hex(model)) 56 56 --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)67 57 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 70 75 end 71 76 … … 73 78 function Send_Target_Cancel () 74 79 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) 76 81 end 77 82 -
trunk/lua/net/net.mobile.lua
r3203 r3240 183 183 184 184 stats.mobstatversion = MySave_PopNetUint8() 185 186 print("stats.mobstatversion",hex(stats.mobstatversion)) 185 187 186 188 -- mobstatversion : http://docs.polserver.com/packets/index.php?Packet=0x11 -
trunk/lua/net/net.partysystem.lua
r3179 r3240 229 229 print("PartyListDialog_StartInviteMode") 230 230 -- start targetting mode 231 StartTargetMode ()231 StartTargetMode_ClientSide() 232 232 gPartyList_InviteNextTarget = true 233 233 end
