[Release]Talisman in Coemu V2 Source

05/26/2009 14:56 felipeboladao#1
look Img its works...

[Only registered and activated users can see links. Click Here To Register...]

In game Server Source go to Handles, ItemEquip
Search for

Code:
            else if ((ItemID >= 181300 && ItemID <= 192000 || ItemID >= 930000 && ItemID <= 940000) && EquipLocation == 9)//Returns Garment Position
            {
                return 9;
            }
Add down this code:
Code:
            else if ((ItemID >= 201003 && ItemID <= 201009) && EquipLocation == 10)//Returns Heaven Position
            {
                return 10;
            }
            else if ((ItemID >= 202003 && ItemID <= 202009) && EquipLocation == 11)//Returns Tower Position
            {
                return 11;
            }
Working??, give me Tranks...
05/26/2009 15:14 TasteofChaos#2
i have another error below it,

at return -1, here's the error:
Error 1 Invalid token 'return' in class, struct, or interface member declaration
Error 2 Type or namespace definition, or end-of-file expected

help me? im in a rush be back later.
05/26/2009 15:23 felipeboladao#3
testeofchaos...

My ItemEquip.cs ;D

Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/11/2009
 * Time: 9:28 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Handlers
{
	/// <summary>
	/// Provides methods for equiping items
	/// </summary>
	public partial class Handler
	{
		public static void ItemEquip(int Location, int UID, ClientSocket CSocket)
		{
			if(CSocket.Client.Inventory.ContainsKey(UID))
			{
				Struct.ItemInfo Item = CSocket.Client.Inventory[UID];
				int TrueLoc = DeterminePosition(Item.ItemID, Location);
				if (Item.ItemID == 1050002 || Item.ItemID == 1050001 || Item.ItemID == 1050000)
					Location = 5;
				if(TrueLoc == Location)
				{
					if(CSocket.Client.Equipment.ContainsKey(Location))
					{
						int Loc2 = CSocket.Client.Equipment[Location].Position;
						int UID2 = CSocket.Client.Equipment[Location].UID;
						ItemUnequip(Loc2, UID2, CSocket);
					}
					//TODO: Item bonuses(attack etc)
					//TODO: Position checks, class requirements
					if(CSocket.Client.Equipment.ContainsKey(Location))
					{
						CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Could not equip the item into that slot.", Struct.ChatType.Top));
						return;
					}
					CSocket.Client.Inventory.Remove(UID);
					Item.Position = Location;
					CSocket.Client.Equipment.Add(Location, Item);
					Database.Database.UpdateItem(Item);
					CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
					CSocket.Send(ConquerPacket.ItemUsage(Item.UID, 255, Struct.ItemUsage.RemoveItem));
                    if (Location == 4 || Location == 5)
                    {
                        if (Item.ItemID != 1050002 && Item.ItemID != 1050001 & Item.ItemID != 1050000)
                        {
                            int Type = Calculation.WeaponType(Convert.ToString(Item.ItemID));
                            if (!CSocket.Client.Profs.ContainsKey(Type))
                            {
                                Struct.CharProf Prof = new Struct.CharProf();
                                Prof.ID = Type;
                                Prof.Level = 1;
                                Prof.Exp = 0;
                                CSocket.Client.Profs.Add(Type, Prof);
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have learned a new weapon proficiency!", Struct.ChatType.Top));
                                Database.Database.NewProf(Prof.ID, Prof.Level, Prof.Exp, CSocket.Client.ID);
                            }
                        }
                    }
					#region ItemCalculations
					switch(Item.Soc1)
					{
						case 1:
							{
								CSocket.Client.NPG++;
								break;
							}
						case 2:
							{
								CSocket.Client.RPG++;
								break;
							}
						case 3:
							{
								CSocket.Client.SPG++;
								break;
							}
						case 11:
							{
								CSocket.Client.NDG++;
								break;
							}
						case 12:
							{
								CSocket.Client.RDG++;
								break;
							}
						case 13:
							{
								CSocket.Client.SDG++;
								break;
							}
						case 71:
							{
								CSocket.Client.NTG++;
								break;
							}
						case 72:
							{
								CSocket.Client.RTG++;
								break;
							}
						case 73:
							{
								CSocket.Client.STG++;
								break;
							}
						default:
							{
								CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Please report: Unknown GemID: " + Item.Soc1, Struct.ChatType.Talk));
								break;
							}
						
					}
					switch(Item.Soc2)
					{
						case 1:
							{
								CSocket.Client.NPG++;
								break;
							}
						case 2:
							{
								CSocket.Client.RPG++;
								break;
							}
						case 3:
							{
								CSocket.Client.SPG++;
								break;
							}
						case 11:
							{
								CSocket.Client.NDG++;
								break;
							}
						case 12:
							{
								CSocket.Client.RDG++;
								break;
							}
						case 13:
							{
								CSocket.Client.SDG++;
								break;
							}
						case 71:
							{
								CSocket.Client.NTG++;
								break;
							}
						case 72:
							{
								CSocket.Client.RTG++;
								break;
							}
						case 73:
							{
								CSocket.Client.STG++;
								break;
							}
						default:
							{
								CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Please report: Unknown GemID: " + Item.Soc2, Struct.ChatType.Talk));
								break;
							}
						
					}
					switch(Item.Bless)
					{
						case 7:
							{
								CSocket.Client.Bless += 7;
								break;
							}
						case 5:
							{
								CSocket.Client.Bless += 5;
								break;
							}
						case 3:
							{
								CSocket.Client.Bless += 3;
								break;
							}
						case 1:
							{
								CSocket.Client.Bless += 1;
								break;
							}
						case 0:
							{
								break;
							}
						default:
							{
								CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Invalid bless: " + Item.Bless, Struct.ChatType.Top));
								break;
							}
					}
					if(Nano.Items.ContainsKey(Item.ItemID))
					{
						Struct.ItemData ItemD = Nano.Items[Item.ItemID];
						CSocket.Client.BaseMagicAttack += ItemD.MagicAttack;
						if(Item.Position == 5)
						{
							CSocket.Client.BaseMaxAttack += (int)Math.Floor(.5*ItemD.MaxDamage);
							CSocket.Client.BaseMinAttack += (int)Math.Floor(.5*ItemD.MinDamage);
						}
						else
						{
							CSocket.Client.BaseMaxAttack += ItemD.MaxDamage;
							CSocket.Client.BaseMinAttack += ItemD.MinDamage;
						}
						CSocket.Client.Defense += ItemD.DefenseAdd;
						CSocket.Client.MaxHP += ItemD.HPAdd;
						CSocket.Client.MaxHP += Item.Enchant;
						CSocket.Client.MagicDefense += ItemD.MDefenseAdd;
						CSocket.Client.MaxMP += ItemD.MPAdd;
						CSocket.Client.Dodge += ItemD.DodgeAdd;
					}
					if(Item.Plus > 0)
					{
						string s_ItemID = Convert.ToString(Item.ItemID);
						int itemidsimple = 0;
						if ((Item.ItemID >= 900000 && Item.ItemID <= 900999) || (Item.ItemID >= 111303 && Item.ItemID <= 118999) || (Item.ItemID >= 130003 && Item.ItemID <= 139999))//Shields, Helms, Armors
		        		{
			                /*s_ItemID = s_ItemID.Remove((s_ItemID.Length - 3), 1);
			                s_ItemID = s_ItemID.Insert((s_ItemID.Length - 2), "0");
			                s_ItemID = s_ItemID.Remove((s_ItemID.Length - 1), 1);
			                s_ItemID = s_ItemID.Insert((s_ItemID.Length), "0");*/
			                s_ItemID = s_ItemID.Remove((s_ItemID.Length -1), 1);
			                s_ItemID = s_ItemID.Insert(s_ItemID.Length, "0");
			                itemidsimple = Convert.ToInt32(s_ItemID);
		        		}
						else if ((Item.ItemID >= 150000 && Item.ItemID <= 160250) || (Item.ItemID >= 500000 && Item.ItemID <= 500400) || (Item.ItemID >= 120003 && Item.ItemID <= 121249) || (Item.ItemID >= 421003 && Item.ItemID <= 421339))//BS's, Bows, Necky/Bags
		        		{
		            		s_ItemID = s_ItemID.Remove((s_ItemID.Length - 1), 1);
		            		s_ItemID = s_ItemID.Insert((s_ItemID.Length), "0");
		            		itemidsimple = Convert.ToInt32(s_ItemID);
		        		}
		        		else if (Item.ItemID >= 510000 && Item.ItemID <= 580400)//2 Hander
		        		{
		            		s_ItemID = s_ItemID.Remove(0, 3);
		            		s_ItemID = s_ItemID.Insert(0, "555");
		            		s_ItemID = s_ItemID.Remove((s_ItemID.Length - 1), 1);
			                s_ItemID = s_ItemID.Insert((s_ItemID.Length), "0");
			                itemidsimple = Convert.ToInt32(s_ItemID);
			            }
			            else if (Item.ItemID >= 410000 && Item.ItemID <= 490400 && itemidsimple == 0)//1 Handers
			            {
			                s_ItemID = s_ItemID.Remove(0, 3);
			                s_ItemID = s_ItemID.Insert(0, "444");
			                s_ItemID = s_ItemID.Remove((s_ItemID.Length - 1), 1);
			                s_ItemID = s_ItemID.Insert((s_ItemID.Length), "0");
			                itemidsimple = Convert.ToInt32(s_ItemID);
			            }
			            if(Nano.ItemPluses.ContainsKey(itemidsimple))
			            {
			            	Struct.ItemPlusDB IPlus = Nano.ItemPluses[itemidsimple];
			            	if(IPlus.DB.ContainsKey(Item.Plus))
			            	{
			            		Struct.ItemPlus iPlus = IPlus.DB[Item.Plus];
			            		CSocket.Client.BaseMaxAttack += iPlus.MaxDmg;
			            		CSocket.Client.BaseMinAttack += iPlus.MinDmg;
			            		CSocket.Client.Defense += iPlus.DefenseAdd;
			            		CSocket.Client.BaseMagicAttack += iPlus.MDamageAdd;
			            		CSocket.Client.BonusMagicAttack += iPlus.MDamageAdd;
			            		CSocket.Client.BonusMagicDefense += iPlus.MDefAdd;
			            		CSocket.Client.MaxHP += iPlus.HPAdd;
			            		CSocket.Client.Dodge += iPlus.DodgeAdd;
			            		//TODO: Dodge, etc
			            	}
			            }
					}
					#endregion
					Calculation.Attack(CSocket);
					ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
				}
				else if(TrueLoc > 0 && TrueLoc != Location)
				{
					CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Incorrect equip location.", Struct.ChatType.Top));
				}
				else if(TrueLoc == -1)
				{
					Handler.UseItem(Item, CSocket);
				}
			}
			else
			{
				CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Item doesn't exist.", Struct.ChatType.Top));
			}
		}
		public static int DeterminePosition(int ItemID, int EquipLocation)
        {
            if (ItemID >= 111000 && ItemID <= 119999 && EquipLocation == 1)//Returns HeadGear Position
            {
                return 1;
            }
            if(ItemID >= 123000 && ItemID <= 123109 && EquipLocation == 1)
            {
            	return 1;
            }
            else if (ItemID >= 120000 && ItemID <= 129999 && EquipLocation == 2)//Returns Necklace Position
            {
                return 2;
            }
            else if (ItemID >= 130000 && ItemID <= 139999 && EquipLocation == 3)//Returns Armor Position
            {
                return 3;
            }
            else if (ItemID >= 410000 && ItemID <= 589999 && EquipLocation == 4)//Returns Weapon Default Position
            {
                return 4;
            }
            else if (ItemID >= 410000 && ItemID <= 589999 && EquipLocation == 5)//Returns Weapon Default Position
            {
                return 5;
            }
            else if(ItemID >= 601000 && ItemID <= 601339 && EquipLocation == 4)//Return Weapon, KATANA!
            {
            	return 4;
            }
            else if(ItemID >= 601000 && ItemID <= 601339 && EquipLocation == 5)//Return Weapon, KATANA!
            {
            	return 5;
            }
            else if (ItemID == 1050002 || ItemID == 1050001 || ItemID == 1050000)
            {
            	return 5;
            }
            else if (ItemID >= 900000 && ItemID <= 900109 && EquipLocation == 5) //Shields
            {
            	return 5;
            }
            else if (ItemID >= 150000 && ItemID <= 159999 && EquipLocation == 6)//Returns Ring Position
            {
                return 6;
            }
            else if (ItemID == 2100045 || ItemID == 2100025 && EquipLocation == 7)//Returns Gourd Position
            {
                return 7;
            }
            else if (ItemID >= 160000 && ItemID <= 169999 && EquipLocation == 8)//Returns Boots Position
            {
                return 8;
            }
            else if ((ItemID >= 181300 && ItemID <= 192000 || ItemID >= 930000 && ItemID <= 940000) && EquipLocation == 9)//Returns Garment Position
            {
                return 9;
            }
            else if ((ItemID >= 201003 && ItemID <= 201009) && EquipLocation == 10)//Returns HeavenTalismam Position
            {
                return 10;
            }
            else if ((ItemID >= 202003 && ItemID <= 202009) && EquipLocation == 11)//Returns TowerTalismam Position
            {
                return 11;
            }
			return -1;
        }
	}
}
05/26/2009 15:43 danielachraf#4
and what about items table in the database ?
05/26/2009 15:45 Kiyono#5
And if you want GoldCup/GoldTrophy/GoldPrize/SilverPrize/BronzePrize equiped, change:
Code:
else if (ItemID == 2100045 || ItemID == 2100025 && EquipLocation == 7)//Returns Gourd Position
            {
                return 7;
            }
into:
Code:
else if (ItemID >= 2100025 && ItemID <= 2100095 && EquipLocation == 7)//Returns Gourd Position
            {
                return 7;
            }
05/26/2009 15:49 zarut#6
offtopic..
why do you use case like that?
you could use case 1: action; break; too (dont get me wrong just a protip)
05/26/2009 15:50 Beta Limit#7
Kiyono could ya help me out bro, i got the open ssl error and have no idea how to fix it
05/26/2009 15:54 Kiyono#8
Quote:
Originally Posted by Beta Limit View Post
Kiyono could ya help me out bro, i got the open ssl error and have no idea how to fix it
Open the Gameserver project expand "Preferences" rightclick ManagedOpenSSL hit remove and re-add.
05/26/2009 16:01 felipeboladao#9
Beta Limit, its simple ,open project from Visual C# and Add Reference

[Only registered and activated users can see links. Click Here To Register...]

Click in Browse and go to \CoEmu v2\CoEmu v2 GameServer
And add libeay32.dll

[Only registered and activated users can see links. Click Here To Register...]

and go to \CoEmu v2\CoEmu v2 GameServer\bin\Debug
and add ManagedOpenSsl.dll

[Only registered and activated users can see links. Click Here To Register...]

Fixed it.
Tranks??
05/26/2009 17:06 Vijftig#10
Quote:
Originally Posted by felipeboladao View Post
Beta Limit, its simple ,open project from Visual C# and Add Reference

[Only registered and activated users can see links. Click Here To Register...]

Click in Browse and go to \CoEmu v2\CoEmu v2 GameServer
And add libeay32.dll

[Only registered and activated users can see links. Click Here To Register...]

and go to \CoEmu v2\CoEmu v2 GameServer\bin\Debug
and add ManagedOpenSsl.dll

[Only registered and activated users can see links. Click Here To Register...]

Fixed it.
Tranks??
I don't have that ddl file :|
05/26/2009 17:14 felipeboladao#11
Vijftig

Re-extract the source. it fix ;D
05/26/2009 17:20 XMasterrrr#12
Thank Youu For This Useful Post
05/26/2009 17:23 Vijftig#13
I found the file >.<

Error:
A reference to "D:\ etc etc etc" could not be added. Please make sure
that the file is accesible, and that it is a valid assembly or COM component.

:|
05/26/2009 17:51 felipeboladao#14
Turn off your computer and restart and do the process again of previous post.
Its Fixed ;D
05/26/2009 18:35 Vijftig#15
restarted computer
still not working :|
and i Re-extracted

Can you send your ddl file please ?

EDIT:

It's working I did nothing :| but ok :D thanks for helping