Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

/pack and /unpack Jewels Source Code

Joined
Nov 29, 2009
Messages
506
Reaction score
92
Joined
Nov 29, 2009
Messages
506
Reaction score
92
its quite sad the source only shows these commands

command.cpp
#include "StdAfx.h"

// Custom Commands
void MakeCommand(int aIndex,char* Message)
{
if(!_strcmpi("/make",Message))
{
GCServerMsgStringSend("Usage: /make <type> <index> <lvl> <skill> <luck> <opt> <exc>",aIndex,1);
return;
}

if(strlen(Message) < 1)
{
GCServerMsgStringSend("Usage: /make <type> <index> <lvl> <skill> <luck> <opt> <exc>",aIndex,1);
return;
}

int Spaces = 0;

for(int i = 0; i < strlen(Message); i++)
{
if(Message == ' ')
{
Spaces++;
}
}

if(Spaces < 6)
{
GCServerMsgStringSend("Please re-check the code string you gave.",aIndex,1);
return;
}

int ItemType,ItemNr,ItemLevel,ItemSkill,ItemLuck,ItemOpt,ItemExc;
sscanf(Message,"%d %d %d %d %d %d %d",&ItemType,&ItemNr,&ItemLevel,&ItemSkill,&ItemLuck,&ItemOpt,&ItemExc);

DWORD Item = ItemType * 512 + ItemNr;

ItemSerialCreateSend(aIndex,gObj[aIndex].MapNumber,gObj[aIndex].X,gObj[aIndex].Y,Item,ItemLevel,0,ItemSkill,ItemLuck,ItemOpt,aIndex,ItemExc,0);

GCServerMsgStringSend("Item created successfully.",aIndex,1);
}

void InitCommands(int aIndex,unsigned char* Protocol)
{
/*char CommandMake[] = "/make";
if(!memcmp(&Protocol[13],CommandMake,strlen(CommandMake)))
{
MakeCommand(aIndex,(char*)Protocol+13+strlen(CommandMake));
}*/
}


command.h:
#ifndef __COMMANDS_H__
#define __COMMANDS_H__

// Function Headers
void InitCommands(int aIndex,unsigned char* Protocol);

#endif
 
Upvote 0
Joined
Oct 8, 2006
Messages
740
Reaction score
289
These sources are actually sources to a DLL which is injected into GameServer.exe.

Why don't you make your own /pack, /unpack commands?
I mean you have to think about the game logic and how it's gonna be done and that's all.

How "pack" command should be done:

- Iterate through inventory for "bless" jewel
- Count them separated
- Delete them in the iteration
- Make a new item jewel packed added to your first free inventory position

How "unpack" command should be done:
- Search the position of the "packed" jewel by iterating through inventory to search for that
- Get the amount of packed jewel
- Delete this packed jewel
- For Loop (int i = 0; i<numberOfPackedJewel) and make new jewel to be added into the first free position in inventory in this loop

I think you already have functions to add items into the first free position.
 
Upvote 0
Back
Top