Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2012, 02:20 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default Remove money from client

I'm trying to figure out how to remove a certain platinum amount from the client in the server code. It looks like m_pp.platinum is what i use to designate the clients platinum but its not recognizing m_pp when i compile. ( error message: 'm_pp' : undeclared identifier) I'm guessing I need to use a #include to another file but I cant figure out which one. Am I doing this wrong?
Reply With Quote
  #2  
Old 02-27-2012, 02:49 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

m_pp is a private member of the Client class (see zone/client.h), so if you were trying to manipulate m_pp.platinum within a method/function of the Client class, it should work.

If you are trying to do this from within a method from another class, then you would need a pointer to a client object, then you could use
Code:
Client::TakeMoneyFromPP(uint64 copper, bool updateclient=false);
If you need further pointers, I would need to know where you are trying to insert this code into the existing source.
Reply With Quote
  #3  
Old 02-27-2012, 03:39 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

I'm trying to add a check and plat removal for spawning a bot, I just cant figure out how to use the above takemoneyfrompp to check for the clients pp amount and then to remove the pp. I want to set the price equal to the clients level. This is all within bot.cpp
Reply With Quote
  #4  
Old 02-27-2012, 03:50 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Well, if you want to do it where the #bot spawn command is processed in bot.cpp, you could add this around line 12424:
Code:
                if(!c->HasMoney(c->GetLevel() * 1000))
                {
                        c->Message(13, "You don't have enough money to spawn a bot.");
                        return;
                }
                c->TakeMoneyFromPP(c->GetLevel() * 1000, true);
That would go just before the existing line:
Code:
Bot* TempBot = LoadBot(botId, &TempErrorMessage);
At that point, the variable 'c' is a pointer to the client that is trying to spawn the bot.

Note that the HasMoney/TakeMoneyFromPP methods take copper as an argument, so 1000 is 1 platinum.

Last edited by Derision; 02-27-2012 at 03:55 PM.. Reason: Updated to scale cost with player level. Set updateclient=true
Reply With Quote
  #5  
Old 02-27-2012, 03:52 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

awesome, thanks a lot!
Reply With Quote
  #6  
Old 02-27-2012, 04:45 PM
louis1016
Hill Giant
 
Join Date: Dec 2009
Posts: 157
Default

I'm trying to use updateclient=true but updateclient isnt recognized, any way I can update the client money after the bot has spawned?

EDIT - NM i figured it out, just saw you updated your posted code, thanks again
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:41 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3