Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

world fishmine

void world_fishmine(void *world_void)
{
   World *world = static_cast<World *>(world_void);

   UTIL_PTR_VECTOR_FOREACH(world->characters, Character, from)
    {
	    int exp = util::rand(1, 400);
	    int amount1 = util::rand(1, 4);
        int random = util::rand(0, 150);
	    if(from->fish == true)
	    {
	        if (random < 9)
              {
                int id = static_cast<int>(world->config["FishItem1"]);//475
                from->AddItem(id, amount1);
                PacketBuilder reply(PACKET_ITEM, PACKET_GET);
                reply.AddShort(0); // UID
                reply.AddShort(id);
                reply.AddThree(amount1);
                reply.AddChar(from->weight);
                reply.AddChar(from->maxweight);
                from->player->client->SendBuilder(reply);
                from->fexp += exp;
                from->LvlUp();
              }
                else if (random >= 9 && random < 14)
                   {
                    int id = static_cast<int>(world->config["FishItem2"]);//400
                    from->AddItem(id, amount1);
                    PacketBuilder reply(PACKET_ITEM, PACKET_GET);
                    reply.AddShort(0); // UID
                    reply.AddShort(id);
                    reply.AddThree(amount1);
                    reply.AddChar(from->weight);
                    reply.AddChar(from->maxweight);
                    from->player->client->SendBuilder(reply);
                    from->fexp += exp;
                    from->LvlUp();
                   }
            else if (random < 150 && random >= 14)
              {

               // from->map->Msg(from, "Fail try again.", true);
              }
	      from->fish = false;
	    }
	      if(from->mine == true)
	      {

            if (random < 9)
              {
                int id = static_cast<int>(world->config["MineItem1"]);//668
                from->AddItem(id, amount1);
                PacketBuilder reply(PACKET_ITEM, PACKET_GET);
                reply.AddShort(0); // UID
                reply.AddShort(id);
                reply.AddThree(amount1);
                reply.AddChar(from->weight);
                reply.AddChar(from->maxweight);
                from->player->client->SendBuilder(reply);
                from->mexp += exp;
                from->LvlUp();
              }
                else if (random >= 9 && random < 14)
                   {
                    int id = static_cast<int>(world->config["MineItem2"]);//400
                    from->AddItem(id, amount1);
                    PacketBuilder reply(PACKET_ITEM, PACKET_GET);
                    reply.AddShort(0); // UID
                    reply.AddShort(id);
                    reply.AddThree(amount1);
                    reply.AddChar(from->weight);
                    reply.AddChar(from->maxweight);
                    from->player->client->SendBuilder(reply);
                    from->mexp += exp;
                    from->LvlUp();
                   }
            else if (random < 150 && random >= 14)
              {

                //from->map->Msg(from, "Fail try again.", true);
              }
          from->mine = false;
         }
    }
}