[Release] Server Buffs based on Online Player Count

02/13/2019 02:18 Naltalah#1
Edit: The consensus of the feedback so far is, that this code is very performance inefficient. If I have the time, I will rewrite the code and reupdate.

I coded this for a friend and thought why not share it with everyone.

Disclaimer: I'm still kind of new to coding, so if you have any suggestions on how to improve the code, let me know <3

I won't be adding a guide on how to create the items that are used as the a buff, there are enough guides on that out there.

ProjectCmn.cpp


Project.cpp


Project.h


User.h


User.cpp


VersionCommon.h (WorldServer)

add this:

PHP Code:
#define        __SYS_ONLINECOUNT_BUFFS
#ifdef __SYS_ONLINECOUNT_BUFFS
#define        __SYS_ONLINECOUNT_BUFFS_MODE    1    // 0 = Only highest buff will be active, 1 = All buffs will be active
#endif // __SYS_ONLINECOUNT_BUFFS 
Resource

You will need to create a new file called onlinebuff.inc.

It has to look like this:

PHP Code:
// dwBuffID                     Online Count
II_ONLINEBUFF_LEVEL1            10
II_ONLINEBUFF_LEVEL2            20 
First comes the ID of the buff, after that the amount of users that have to be online to apply this buff.

Please note that this does not work for multiple channels.

I also added these instruction as an attachment if you want to save it for later.
02/13/2019 02:56 comcem#2
thank you for this
02/13/2019 11:09 LookAtTheFlower#3
Thank you for this release! great job :)
02/14/2019 23:20 comcem#4
[Only registered and activated users can see links. Click Here To Register...]

Have I got this error in Compiling how to solve it?
02/15/2019 08:17 Naltalah#5
You either didnt add the code to the Project.h or you added it at the wrong spot in the Project.h
02/15/2019 14:58 comcem#6
Quote:
Originally Posted by Naltalah View Post
You either didnt add the code to the Project.h or you added it at the wrong spot in the Project.h
I checked, but the error persists even though I check everything correctly

Check [Only registered and activated users can see links. Click Here To Register...] <-
02/15/2019 16:44 Avalion#7
Quote:
Originally Posted by comcem View Post
I checked, but the error persists even though I check everything correctly

Check [Only registered and activated users can see links. Click Here To Register...] <-
Project.h in _Common folder
02/15/2019 16:52 comcem#8
Quote:
Originally Posted by Avalion View Post
Project.h in _Common folder
This Project.h is in the Project in this folder, please help me
02/16/2019 08:08 xToffer#9
Quote:
Originally Posted by comcem View Post
This Project.h is in the Project in this folder, please help me
define it to versioncommon.h of world only
02/16/2019 15:06 comcem#10
Quote:
Originally Posted by xToffer View Post
define it to versioncommon.h of world only
It's really not working here, and I do not know why, I've been trying to figure it out since yesterday. and I can not
02/16/2019 15:18 .S0ulSeller#11
I mean the function is being defined only for WorldServer and is being used by WorldServer,Neuz and Database server as the error tells you. Without checking the code I'd suggest adding a #ifdef __WORLDSERVER arround the LoadOnlineCountFile() function.
When you check your screen shot you posted you see that the snippet in project.h is grayed out which means that the compiler skips this snippet when compiling neuz and databaseserver... unfortunate when you tell him to use the function in the .cpp file for those projects aswell
02/16/2019 15:32 comcem#12
Quote:
Originally Posted by .S0ulSeller View Post
I mean the function is being defined only for WorldServer and is being used by WorldServer,Neuz and Database server as the error tells you. Without checking the code I'd suggest adding a #ifdef __WORLDSERVER arround the LoadOnlineCountFile() function.
When you check your screen shot you posted you see that the snippet in project.h is grayed out which means that the compiler skips this snippet when compiling neuz and databaseserver... unfortunate when you tell him to use the function in the .cpp file for those projects aswell
Fixed ! Thank you
02/17/2019 04:22 campomanes25#13
how to fix this error? [Only registered and activated users can see links. Click Here To Register...]
Im using visual studio 2003
02/21/2019 11:07 yazuka21#14
Can I request example line for Spec_Item. Thanks !
02/21/2019 18:25 Nιgнтмαяε#15
Quote:
Originally Posted by yazuka21 View Post
Can I request example line for Spec_Item. Thanks !
II_SYS_SYS_LS_BLESSING :rollsafe: