• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Packets on the whole.

Status
Not open for further replies.

slp13at420

Mad Scientist

Eluna question

ok I am at a point that I need to utilize packets but im not really finding anything on packets except this gem:
http://emudevs.com/showthread.php/3...d-mark-on-player?p=21214&viewfull=1#post21214
which is rather very help since its shows an actual lua packet :D
so now my question is . is there a wiki or some sort of file/list somewhere I can reference to understand that 801 = MSG_RAID_TARGET_UPDATE ?
what im trying to do is:
1 add random amount of gold to a players guild bank.
2 send a guild invite to a player when no guild members are online via a GO.(a guild flag for guild warz). i'm using the local function SendGuildInvite that is recieving player, guild name, and guild id from here
basically just need to find the packet id list
lol
and really? 801 damn lotta frigin packet idz :rofl:
 
Last edited:

Rochet2

Moderator / Eluna Dev
so now my question is . is there a wiki or some sort of file/list somewhere I can reference to understand that 801 = MSG_RAID_TARGET_UPDATE ?
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Server/Protocol/Opcodes.h
Here. The hex values are fine to be used in lua as well.

btw raid target has a method, but it is for group only : /
https://github.com/ElunaLuaEngine/Eluna/blob/master/GroupMethods.h#L225

.. Im not so sure if setting money and inviting ppl is going to work just with packets .. but you are free to try :3
 

Rochet2

Moderator / Eluna Dev
CMSG_GUILD_BANK_DEPOSIT_MONEY = 0x3EC,
now I have to convert 0x03EC to base 10 right?
and use guildID?
No. Like I said before, hex works fine.
print(0x03EC) will print the decimal representation of the hex, which is 1004.

Btw. CMSG_GUILD_BANK_DEPOSIT_MONEY is a client packet, which means that client sends it to server.
Currently there is no way to fake receive a packet from client.

Also, the packet handler on server seems to be this:
Code:
void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
{
    uint64 guid;
    uint32 money;
    recvData >> guid >> money;

    TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
        GetPlayerInfo().c_str(), guid, money);

    if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
        if (money && GetPlayer()->HasEnoughMoney(money))
            if (Guild* guild = GetPlayer()->GetGuild())
                guild->HandleMemberDepositMoney(this, money);
}
From it we can read that guid NEEDS to be a valid guild bank object : /



Also notice these:
https://github.com/ElunaLuaEngine/Eluna/blob/master/LuaFunctions.cpp#L1032
These functions may be moved to Player functions though, but they are guild functions for now.
 

slp13at420

Mad Scientist
lol yea I caught that . was testing with 1004 and 0x03EC and was experiment with the building the packet and then my p/s died rofl so gotta pick a new on up tomorrow.
when I get my pc running tomorrow I will take another crack at it with the new info .
thanx :D
 

Rochet2

Moderator / Eluna Dev
the core keeps saying the DepositBankMoney() is a nil value.
and I may be way off in left field with building the packet :rofl:

Do you still have problems with this?
How are you using DepositBankMoney?
It should be used like guild:DepositBankMoney(player, amount)
Same with WithdrawBankMoney.
 

slp13at420

Mad Scientist
ok here is clip of where I am at so far :

https://github.com/BlackWolfsDen/testing/blob/master/guild/guild_gold_perk.lua

its one of Foe'z older ArcEmu lua's i'm trying to convert to Eluna so I am only showing building the packet part. until its working :D
but havn't been able to get time to get back to it we got a sudden influx of service calls and been pulling 13hr days 6days a week ...

so im going to try using player get guild for guild deposit money.

- - - Updated - - -

player:GetGuild():DepositBankMoney(gold*0.1)

bad argument #1 to 'DepositBankMoney (Player expected)

- - - Updated - - -

lol ooops

- - - Updated - - -

player:GetGuild():DepositBankMoney(player, (gold*0.1))
attempt to index a number value
 

slp13at420

Mad Scientist
ok now the method DepositGuildMoney works :D
Code:
player:GetGuild():DepositBankMoney(player, gold)
 
Last edited:

slp13at420

Mad Scientist
Code:
function GBank_Loot(eventid, player, gold)
local gold = 100000 -- 10 gold so deposit should be 1 gold.
	if(player:IsInGuild()) then
	    local data = CreatePacket(0x03EC, (1+8+1+8)) -- 0x03EC
	    data:WriteUByte(0);
	    data:WriteGUID(12496);-- GUID of guild vault in orgrimmar testing using horde toon while close to guild vault.
	    data:WriteUByte(0);
	    data:WriteGUID(gold*0.1);-- 10% of looted gold.
	    player:GetGuildId():SendPacket(data);
	end
end

RegisterPlayerEvent(37, GBank_Loot)
line 9 attempt to index a number value

but since I know how to use the method PROPERLY now :facepalm: I think this can be marked solved but I will continue to pursue working with packets properly :D
 
Last edited:

Rochet2

Moderator / Eluna Dev
Code:
function GBank_Loot(eventid, player, gold)
local gold = 100000 -- 10 gold so deposit should be 1 gold.
	if(player:IsInGuild()) then
	    local data = CreatePacket(0x03EC, (1+8+1+8)) -- 0x03EC
	    data:WriteUByte(0);
	    data:WriteGUID(12496);-- GUID of guild vault in orgrimmar testing using horde toon while close to guild vault.
	    data:WriteUByte(0);
	    data:WriteGUID(gold*0.1);-- 10% of looted gold.
	    player:GetGuildId():SendPacket(data);
	end
end

RegisterPlayerEvent(37, GBank_Loot)
line 9 attempt to index a number value

but since I know how to use the method PROPERLY now :facepalm: I think this can be marked solved but I will continue to pursue working with packets properly :D

The problem with line 9 is that you are getting a guildid ( a number ) and then using SendPacket on it.
Now.. rather obviously 5:SendPacket() isnt going to work that well.
You should send the packet to the player, or the guild. Not guild ID.

You sure that WriteGUID is right?
WriteGUID expects a string.
GUID is supposed to be an uint64 number, but lua does not support that data type so we handle it as a string.
 
Last edited:

slp13at420

Mad Scientist
Code:
function GBank_deposit(eventid, player, msg)
local gold = 100000 -- 10 gold so deposit should be 1 gold.
	if (msg) == "#deposit" then
		if(player:IsInGuild()) then
		    local data = CreatePacket(0x03EC, (1+8+1+8)) -- 0x03EC
		    data:WriteUByte(0);
		    data:WriteGUID(12496);-- GUID of guild vault in orgrimmar testing using horde toon while close to guild vault.
		    data:WriteUByte(0);
		    data:WriteGUID(gold);
		    player:GetGuild():SendPacket(data);
	    end
	end
end

RegisterPlayerEvent(18, GBank_deposit)

k changed it to GetGuild() a userdata I think...
as far as placing the data in the proper sequence I am taking shots in the dark till I get a reaction and then adjust for effect. :rofl:
 
Last edited:
Status
Not open for further replies.
Top