예제 #1
0
	public UsableItem (string pmName, string pmDescription, List<EquipementTypes> pmTypes, SelfEffect pmSelfEffect)
	{
		mName = pmName;
		mDescription = pmDescription;
		mEquipementTypes = pmTypes;
		mSelfEffect = pmSelfEffect;
	}
	public static void AddUsableItemsToInventory(int pmPlayerId, Dictionary<string,Item> pmInventory, Player player)
	{
		IDbConnection dbconn = GetConnection ();
		IDbCommand dbcmd = dbconn.CreateCommand();
		string sqlQuery = "select ui.NAME, ui.DESCRIPTION, ui.EFFECT_TYPE, ui.DIECE_NUMBER, ui.DIECE_VALUE, ui.STATIC_VALUE, ui.TARGETS_NUMBER, ui.TARGETS_TYPE, ui.RANGE, ui.EFFECT_SHAPE, ui.EFFECT_SHAPE_SIZE, ui.ICON_NAME, es.NAME, ui.CAN_BE_SHORTCUT " +
			" from usable_items ui join CHARACTERS_ITEMS ci on ci.ITEM_ID = ui.ID  and ci.ITEM_TYPE = 3 JOIN EQUIPEMENT_SLOTS es on ci.FIELD_ID = es.ID where ci.CHARACTER_ID = " + pmPlayerId;	
		dbcmd.CommandText = sqlQuery;

		IDataReader reader = dbcmd.ExecuteReader();
		while (reader.Read ()) {

			List<EquipementTypes> types = new List<EquipementTypes> ();
			types.Add (EquipementTypes.ANY);

			Debug.Log ("AAAA" + reader.GetString (0));
			Debug.Log ("BBBB" + reader.GetInt32 (3));
			Debug.Log ("CCCC" + reader.GetInt32 (4));
			Debug.Log ("DDDD" + reader.GetInt32 (5));
			Debug.Log ("EEEE" + reader.GetInt32 (2));

			SelfEffect effect = new SelfEffect (reader.GetString (0),
				                    null,
				                    reader.GetInt32 (3),
				                    reader.GetInt32 (4),
				                    reader.GetInt32 (5),
				                    reader.GetInt32 (2)
			                    );

			Item lvItem = new UsableItem (reader.GetString (0), reader.GetString (1), types, effect);  
			lvItem.resourceImageName = reader.GetString (11);
			lvItem.inventoryFieldId = reader.GetString (12);


			pmInventory.Add (reader.GetString (12), lvItem);
		}

		CleanUp (reader,dbcmd,dbconn);
		reader = null;
		dbcmd = null;
		dbconn = null;
	}